import 'package:flutter/material.dart';
import 'route_stytle.dart';

class FirstPage extends StatefulWidget {
  @override
  _FirstPageState createState() => _FirstPageState();
}

class _FirstPageState extends State<FirstPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "FirstPage",
          style: TextStyle(fontSize: 36.0, color: Colors.white),
        ),
        elevation: 1.0, //融合情况  appbar  与body
      ),
      body: Center(
        child: MaterialButton(
          onPressed: () {
            Navigator
                .of(context)
                .push(
                CustomeRoute(SecondPage()));
            },
          child: Icon(
            Icons.navigate_next,
            color: Colors.white,
            size: 64.0,
          ),
        ),
      ),
      backgroundColor: Colors.blue,
    );
  }
}

class SecondPage extends StatefulWidget {
  @override
  _SecondPageState createState() => _SecondPageState();
}

class _SecondPageState extends State<SecondPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.redAccent,
      appBar: AppBar(
        title: Text(
          "SecondPage",
          style: TextStyle(fontSize: 36.0, color: Colors.white),

        ),
        leading: Container(),
        backgroundColor: Colors.redAccent,
        elevation: 4.0, //融合情况
      ),
      body: Center(
        child: MaterialButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
          child: Icon(
            Icons.navigate_next,
            color: Colors.white,
            size: 64.0,
          ),
        ),
      ),
    );
  }
}

